Skip to content

Remove fewer Storage calls in CopyProp and GVN #142531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

ohadravid
Copy link
Contributor

@ohadravid ohadravid commented Jun 15, 2025

Modify the CopyProp and GVN MIR optimization passes to remove fewer Storage{Live,Dead} calls, allowing for better optimizations by LLVM - see #141649.

Details

The idea is to use a new MaybeUninitializedLocals analysis and remove only the storage calls of locals that are maybe-uninit when accessed in a new location.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 15, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@matthiaskrgr
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2025
bors added a commit that referenced this pull request Jun 15, 2025
…try>

Remove fewer Storage calls in `copy_prop`

Modify the `copy_prop` MIR optimization pass to remove fewer `Storage{Live,Dead}` calls, allowing for better optimizations by LLVM - see #141649.

### Details

This is my attempt to fix the mentioned issue (this is the first part, I also implemented a similar solution for GVN in [this branch](https://github.com/rust-lang/rust/compare/master...ohadravid:rust:better-storage-calls-gvn-v2?expand=1)).

The idea is to use the `MaybeStorageDead` analysis and remove only the storage calls of `head`s that are maybe-storage-dead when the associated `local` is accessed (or, conversely, keep the storage of `head`s that are for-sure alive in _every_ relevant access).

When combined with the GVN change, the final example in the issue (#141649 (comment)) is optimized as expected by LLVM. I also measured the effect on a few functions in `rav1d` (where I originally saw the issue) and observed reduced stack usage in several of them.

This is my first attempt at working with MIR optimizations, so it's possible this isn't the right approach — but all tests pass, and the resulting diffs appear correct.

r? tmiasko

since he commented on the issue and pointed to these passes.
@bors
Copy link
Collaborator

bors commented Jun 15, 2025

⌛ Trying commit d24d035 with merge ef7d206...

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

☀️ Try build successful - checks-actions
Build commit: ef7d206 (ef7d20666974f0dac45b03e051f2e283f9d9f090)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ef7d206): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 8
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 8

Max RSS (memory usage)

Results (primary 0.7%, secondary 3.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
3.5% [1.8%, 5.0%] 5
Regressions ❌
(secondary)
3.4% [3.4%, 3.4%] 1
Improvements ✅
(primary)
-3.9% [-6.5%, -2.0%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-6.5%, 5.0%] 8

Cycles

Results (primary -0.6%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.8% [3.8%, 3.8%] 1
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-4.1% [-4.1%, -4.1%] 1
All ❌✅ (primary) -0.6% [-0.6%, -0.6%] 1

Binary size

Results (primary 0.0%, secondary 0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 0.8%] 10
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 5
Improvements ✅
(primary)
-0.2% [-0.8%, -0.0%] 8
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 0.0% [-0.8%, 0.8%] 18

Bootstrap: 757.399s -> 756.065s (-0.18%)
Artifact size: 372.20 MiB -> 372.12 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 15, 2025
@ohadravid
Copy link
Contributor Author

@matthiaskrgr - I updated the impl to stop re-checking once a head is found to be maybe-dead, which should be a bit better

@matthiaskrgr
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2025
@bors
Copy link
Collaborator

bors commented Jun 15, 2025

⌛ Trying commit 905e968 with merge c0a2949...

bors added a commit that referenced this pull request Jun 15, 2025
…try>

Remove fewer Storage calls in `copy_prop`

Modify the `copy_prop` MIR optimization pass to remove fewer `Storage{Live,Dead}` calls, allowing for better optimizations by LLVM - see #141649.

### Details

This is my attempt to fix the mentioned issue (this is the first part, I also implemented a similar solution for GVN in [this branch](https://github.com/rust-lang/rust/compare/master...ohadravid:rust:better-storage-calls-gvn-v2?expand=1)).

The idea is to use the `MaybeStorageDead` analysis and remove only the storage calls of `head`s that are maybe-storage-dead when the associated `local` is accessed (or, conversely, keep the storage of `head`s that are for-sure alive in _every_ relevant access).

When combined with the GVN change, the final example in the issue (#141649 (comment)) is optimized as expected by LLVM. I also measured the effect on a few functions in `rav1d` (where I originally saw the issue) and observed reduced stack usage in several of them.

This is my first attempt at working with MIR optimizations, so it's possible this isn't the right approach — but all tests pass, and the resulting diffs appear correct.

r? tmiasko

since he commented on the issue and pointed to these passes.
@cjgillot
Copy link
Contributor

Should this check happen in Replacer::visit_local, and move the replacement of storage statements to a dedicated cleanup visitor?

@bors
Copy link
Collaborator

bors commented Jun 15, 2025

☀️ Try build successful - checks-actions
Build commit: c0a2949 (c0a294957df10fc3880e1677c72c0cf122485509)

@rust-timer

This comment has been minimized.

@ohadravid
Copy link
Contributor Author

Should this check happen in Replacer::visit_local

I'm not sure how to make this work: using ResultsCursor requires a &body, but it's not possible to have that while running a MutVisitor since it requires a &mut body.

Is there a different way to do this?

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c0a2949): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 9
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 9

Max RSS (memory usage)

Results (primary -0.1%, secondary -1.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.2% [3.4%, 5.8%] 4
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
-4.4% [-6.6%, -1.8%] 4
Improvements ✅
(secondary)
-5.8% [-5.8%, -5.8%] 1
All ❌✅ (primary) -0.1% [-6.6%, 5.8%] 8

Cycles

Results (secondary -1.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.5%] 2
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.0%, secondary 0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 0.8%] 10
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 5
Improvements ✅
(primary)
-0.2% [-0.8%, -0.0%] 8
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) -0.0% [-0.8%, 0.8%] 18

Bootstrap: 756.494s -> 757.685s (0.16%)
Artifact size: 372.15 MiB -> 372.11 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 15, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@cjgillot
Copy link
Contributor

@ohadravid do you mind merging this PR and #142819? Both should use the same code to decide whether to keep or remove storage statements. And I fear that having 2 PRs mean that @tmiasko and I won't see each other ideas and give you diverging advice.

@ohadravid ohadravid force-pushed the better-storage-calls-copy-prop branch from fdcc8a6 to 26fc160 Compare June 22, 2025 16:30
@ohadravid
Copy link
Contributor Author

ohadravid commented Jun 22, 2025

@cjgillot , @tmiasko - merged both PR here.

Current impls are based on the new MaybeUninitializedLocals analysis in both passes, with all the new tests cases passing.

Does GVN require an additional check against borrowed locals like mentioned in #142531 (comment)?

Both only do the more complex analysis when tcx.sess.emit_lifetime_markers(), so they shouldn't negatively affect check/debug builds, but the last perf run did show some changes to them as well.

And thank you both for reviewing these and explaining everything! 🙏

@ohadravid ohadravid changed the title Remove fewer Storage calls in copy_prop Remove fewer Storage calls in CopyProp and GVN Jun 22, 2025
@tmiasko
Copy link
Contributor

tmiasko commented Jun 25, 2025

I am not familiar with GVN, so I will leave review of that part to @cjgillot .

@bors
Copy link
Collaborator

bors commented Jun 25, 2025

☔ The latest upstream changes (presumably #142870) made this pull request unmergeable. Please resolve the merge conflicts.

@ohadravid ohadravid force-pushed the better-storage-calls-copy-prop branch from 26fc160 to 5c21ce3 Compare June 29, 2025 05:40
@rust-log-analyzer

This comment has been minimized.

@ohadravid ohadravid force-pushed the better-storage-calls-copy-prop branch from 654c4a2 to ab1da60 Compare June 29, 2025 07:22
@rust-log-analyzer

This comment has been minimized.

@ohadravid ohadravid force-pushed the better-storage-calls-copy-prop branch from ab1da60 to e69bef8 Compare June 29, 2025 07:34
@rust-log-analyzer

This comment has been minimized.

@ohadravid
Copy link
Contributor Author

ohadravid commented Jun 29, 2025

@tmiasko - implemented all the changes 😄

I also updated the GVN code since they applied there are well (use a single storage_to_remove bitset, added a test and a fix for unreachable blocks, updated the base issue test to use MIR, added FileCheck annotations) @cjgillot

I can also split this PR if needed, and I'll polish the git history when you think this looks good enough 🧹

PS
I'm getting (again) CI errors on reordered storage statements in some tests (like tests/mir-opt/pre-codegen/derived_ord.rs), but I'm not sure why.

@ohadravid ohadravid requested a review from tmiasko June 29, 2025 08:52
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 48)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 51)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 68)
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--set', 'gcc.download-ci-gcc=true', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
  Number of decisions:   4439
  longest path:          1159 (code:    152)
  longest backtrack:       66 (code:    428)
Shared 87642 out of 154040 states by creating 14936 new states, saving 72706
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc: In function ‘rtx_def* extract_bit_field_1(rtx, poly_uint64, poly_uint64, int, rtx, machine_mode, machine_mode, bool, bool, rtx_def**)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc:1864:45: warning: ‘*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))’ may be used uninitialized [-Wmaybe-uninitialized]
 1864 |       rtx sub = extract_bit_field_as_subreg (mode1, op0, imode,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
 1865 |                                              bitsize, bitnum);
      |                                              ~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/expmed.cc:1824:19: note: ‘*(unsigned int*)((char*)&imode + offsetof(scalar_int_mode, scalar_int_mode::m_mode))’ was declared here
 1824 |   scalar_int_mode imode;
      |                   ^~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gimple-range-gori.cc: In member function ‘void range_def_chain::dump(FILE*, basic_block, const char*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gimple-range-gori.cc:318:19: warning: format not a string literal and no format arguments [-Wformat-security]
  318 |           fprintf (f, prefix);
      |           ~~~~~~~~^~~~~~~~~~~
---
                 from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/analyzer/region-model.h:33,
                 from /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/analyzer/access-diagram.cc:38:
In constructor ‘ana::byte_range::byte_range(ana::byte_offset_t, ana::byte_size_t)’,
    inlined from ‘virtual text_art::table ana::string_literal_spatial_item::make_table(const ana::bit_to_table_map&, text_art::style_manager&) const’ at /checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/analyzer/access-diagram.cc:1811:18:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/analyzer/store.h:312:5: warning: ‘size_in_bytes.generic_wide_int<fixed_wide_int_storage<128> >::fixed_wide_int_storage<128>.fixed_wide_int_storage<128>::val[1]’ may be used uninitialized [-Wmaybe-uninitialized]
  312 |     m_size_in_bytes (size_in_bytes)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/analyzer/access-diagram.cc: In member function ‘virtual text_art::table ana::string_literal_spatial_item::make_table(const ana::bit_to_table_map&, text_art::style_manager&) const’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/analyzer/access-diagram.cc:1807:28: note: ‘size_in_bytes.generic_wide_int<fixed_wide_int_storage<128> >::fixed_wide_int_storage<128>.fixed_wide_int_storage<128>::val[1]’ was declared here
 1807 |                byte_size_t size_in_bytes
      |                            ^~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/diagnostic.cc: In function ‘void fancy_abort(const char*, int, const char*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/diagnostic.cc:1729:15: warning: format not a string literal and no format arguments [-Wformat-security]
 1729 |       fnotice (stderr, diagnostic_kind_text[DK_ICE]);
---
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc:7938:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 7938 |   write (fd, "\n\n", 2);
      |   ~~~~~~^~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc: In member function ‘void driver::final_actions() const’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/gcc.cc:9315:13: warning: ignoring return value of ‘int truncate(const char*, __off_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 9315 |     truncate(totruncate_file, 0);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc: In function ‘void lto_resolution_read(splay_tree, FILE*, lto_file*)’:
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2095:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2095 |   fscanf (resolution, " ");   /* Read white space.  */
      |   ~~~~~~~^~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2097:9: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2097 |   fread (obj_name, sizeof (char), name_len, resolution);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/lto/lto-common.cc:2117:10: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
 2117 |   fscanf (resolution, "%u", &num_symbols);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/checkout/obj/build/x86_64-unknown-linux-gnu/gcc/src/gcc/../libgcc/libgcov-util.c: In function ‘gcov_info* gcov_read_profile_dir(const char*, int)’:
---
Applying io_quotes_use            to linux/blkzoned.h
Applying io_quotes_use            to linux/aspeed-p2a-ctrl.h
Applying io_quotes_use            to linux/vduse.h
Applying io_quotes_use            to linux/blkpg.h
Applying io_quotes_use            to linux/tps6594_pfsm.h
Applying io_quotes_use            to linux/uinput.h
Applying io_quotes_use            to linux/sockios.h
Applying io_quotes_use            to linux/usb/tmc.h
Applying io_quotes_use            to linux/nbd.h
Applying io_quotes_def            to linux/version.h
---
Applying io_quotes_def            to sudo_plugin.h
Applying io_quotes_use            to sudo_plugin.h
Applying io_quotes_use            to video/sisfb.h
Applying io_quotes_use            to scsi/cxlflash_ioctl.h
Applying io_quotes_use            to misc/mrvl_cn10k_dpi.h
Applying io_quotes_use            to misc/ocxl.h
Applying io_quotes_use            to misc/xilinx_sdfec.h
Applying io_quotes_use            to misc/cxl.h
Applying sun_malloc               to malloc.h
Applying machine_name             to openssl/e_os2.h
Applying io_quotes_use            to drm/exynos_drm.h
Applying io_quotes_use            to drm/qaic_accel.h
Applying io_quotes_use            to drm/amdgpu_drm.h
Applying io_quotes_use            to drm/xe_drm.h
Applying io_quotes_use            to drm/lima_drm.h
Applying io_quotes_use            to drm/omap_drm.h
Applying io_quotes_use            to drm/msm_drm.h
Applying io_quotes_use            to drm/vgem_drm.h
Applying io_quotes_use            to drm/vc4_drm.h
Applying io_quotes_use            to drm/drm.h
Applying io_quotes_use            to drm/tegra_drm.h
Applying io_quotes_use            to drm/habanalabs_accel.h
Applying io_quotes_use            to drm/v3d_drm.h
Applying io_quotes_use            to drm/etnaviv_drm.h
Applying io_quotes_use            to drm/i915_drm.h
Applying io_quotes_use            to drm/radeon_drm.h
Applying io_quotes_use            to drm/nouveau_drm.h
Applying io_quotes_use            to drm/panfrost_drm.h
Applying io_quotes_use            to drm/pvr_drm.h
Applying io_quotes_use            to sys/epoll.h
Applying machine_name             to sys/rseq.h
Applying io_quotes_use            to sys/raw.h
Applying io_quotes_use            to sys/mount.h
Applying machine_name             to sys/mount.h
---
48           _4 = copy _1;
49           StorageLive(_10);
-           StorageLive(_11);
-           StorageLive(_12);
52           _10 = discriminant(_4);
53           switchInt(move _10) -> [0: bb7, 1: bb6, otherwise: bb1];
54       }

92       }
93   
94       bb5: {
-           StorageDead(_12);
-           StorageDead(_11);
97           StorageDead(_10);
98           StorageDead(_4);
99           _5 = discriminant(_3);

102       }
103   
104       bb6: {
+           StorageLive(_12);
105           _12 = move ((_4 as Err).0: i32);
106           StorageLive(_13);
107           _13 = Result::<Infallible, i32>::Err(copy _12);

108           _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13);
109           StorageDead(_13);
+           StorageDead(_12);
110 -         goto -> bb5;
111 +         goto -> bb8;
112       }

113   
114       bb7: {
+           StorageLive(_11);
115           _11 = move ((_4 as Ok).0: i32);
116           _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(copy _11);
+           StorageDead(_11);
117           goto -> bb5;
118 +     }
119 + 

120 +     bb8: {
- +         StorageDead(_12);
- +         StorageDead(_11);
123 +         StorageDead(_10);
124 +         StorageDead(_4);
125 +         _5 = discriminant(_3);


thread '[mir-opt] tests/mir-opt/jump_threading.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- [mir-opt] tests/mir-opt/pre-codegen/derived_ord.rs stdout ----
37     }
38 
---
80     }
81 
82     bb3: {
+         StorageLive(_12);
83         _12 = move ((_11 as Some).0: std::cmp::Ordering);
84         StorageLive(_13);
85         _13 = discriminant(_12);

86         _0 = Le(move _13, const 0_i8);
87         StorageDead(_13);
-         StorageDead(_11);
89         StorageDead(_12);
+         StorageDead(_11);
90         return;
91     }
92 }


thread '[mir-opt] tests/mir-opt/pre-codegen/derived_ord.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/derived_ord.demo_le.PreCodegen.after.mir

---- [mir-opt] tests/mir-opt/pre-codegen/loops.rs stdout ----
62     bb1: {
63         StorageLive(_13);
64         _5 = &mut _4;
---
93         StorageDead(_6);
+         StorageLive(_11);
94         _11 = copy (_4.0: usize);
95         StorageLive(_12);
96         _12 = AddUnchecked(copy _11, const 1_usize);

97         (_4.0: usize) = move _12;
98         StorageDead(_12);
99         _13 = Option::<usize>::Some(copy _11);
-         StorageDead(_10);
101         StorageDead(_11);
+         StorageDead(_10);
102         StorageLive(_14);
103         _14 = copy ((_13 as Some).0: usize);
104         _15 = opaque::<usize>(move _14) -> [return: bb4, unwind continue];


thread '[mir-opt] tests/mir-opt/pre-codegen/loops.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir

---- [mir-opt] tests/mir-opt/pre-codegen/range_iter.rs stdout ----
26     }
27 
28     bb0: {
---
46     bb2: {
+         StorageLive(_5);
47         _5 = copy ((*_1).0: u32);
48         StorageLive(_6);
49         _6 = AddUnchecked(copy _5, const 1_u32);

50         ((*_1).0: u32) = move _6;
51         StorageDead(_6);
52         _0 = Option::<u32>::Some(copy _5);
+         StorageDead(_5);
53         goto -> bb3;
54     }
---
60     }
61 }


thread '[mir-opt] tests/mir-opt/pre-codegen/range_iter.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir

---- [mir-opt] tests/mir-opt/pre-codegen/simple_option_map.rs stdout ----
29         StorageLive(_6);
30         StorageLive(_4);
31         StorageLive(_2);
-         StorageLive(_3);
33         _2 = discriminant(_1);
34         switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
35     }

36 
37     bb1: {
-         StorageDead(_3);
---
44     }
45 
46     bb2: {
+         StorageLive(_3);
47         _3 = copy ((_1 as Some).0: i32);
48         _4 = ControlFlow::<Option<Infallible>, i32>::Continue(copy _3);
49         StorageDead(_3);


thread '[mir-opt] tests/mir-opt/pre-codegen/simple_option_map.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/simple_option_map.map_via_question_mark.PreCodegen.after.mir

---- [mir-opt] tests/mir-opt/pre-codegen/slice_index.rs stdout ----
38         StorageLive(_11);
39         StorageLive(_5);
40         _5 = &raw mut (*_1);
-         StorageLive(_8);
42         StorageLive(_6);
43         _6 = PtrMetadata(copy _1);
44         _7 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::precondition_check(copy _3, copy _4, move _6) -> [return: bb1, unwind unreachable];

46 
47     bb1: {
48         StorageDead(_6);
+         StorageLive(_8);
49         _8 = SubUnchecked(copy _4, copy _3);
50         StorageLive(_9);
-         StorageLive(_10);
52         _9 = copy _5 as *mut u32 (PtrToPtr);
+         StorageLive(_10);
53         _10 = Offset(copy _9, copy _3);
54         _11 = *mut [u32] from (copy _10, copy _8);
55         StorageDead(_10);


thread '[mir-opt] tests/mir-opt/pre-codegen/slice_index.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir

---- [mir-opt] tests/mir-opt/separate_const_switch.rs stdout ----
39       bb0: {
40           StorageLive(_2);
41           StorageLive(_6);
-           StorageLive(_7);
-           StorageLive(_8);
44           _6 = discriminant(_1);
45           switchInt(move _6) -> [0: bb6, 1: bb5, otherwise: bb1];
46       }

69       }
70   
71       bb4: {
-           StorageDead(_8);
-           StorageDead(_7);
74           StorageDead(_6);
75           _3 = discriminant(_2);
76 -         switchInt(move _3) -> [0: bb2, 1: bb3, otherwise: bb1];

78       }
79   
80       bb5: {
+           StorageLive(_8);
81           _8 = copy ((_1 as Err).0: i32);
82           StorageLive(_9);
83           _9 = Result::<Infallible, i32>::Err(copy _8);

84           _2 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _9);
85           StorageDead(_9);
+           StorageDead(_8);
86 -         goto -> bb4;
87 +         goto -> bb7;
88       }

89   
90       bb6: {
+           StorageLive(_7);
91           _7 = copy ((_1 as Ok).0: i32);
92           _2 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(copy _7);
+           StorageDead(_7);
93           goto -> bb4;
94 +     }
95 + 

96 +     bb7: {
- +         StorageDead(_8);
- +         StorageDead(_7);
99 +         StorageDead(_6);
100 +         _3 = discriminant(_2);
101 +         goto -> bb3;


thread '[mir-opt] tests/mir-opt/separate_const_switch.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff


failures:
    [mir-opt] tests/mir-opt/jump_threading.rs
    [mir-opt] tests/mir-opt/pre-codegen/derived_ord.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants